/*
 * Copyright (c) 2012-2014, EpicSaaS Yuan Xin technology Co., Ltd.
 * 
 * All rights reserved.
 */
package com.epicsaas.app.ksdapp.controller.phone;

import com.epicpaas.sdk.core.api.logging.Logger;
import com.epicpaas.sdk.core.api.logging.LoggerFactory;
import com.epicpaas.sdk.core.api.ServiceResult;
import com.epicsaas.framework.util.DateTimeUtils;
import com.epicsaas.app.ksdapp.common.MVCViewName;
import com.epicsaas.app.ksdapp.android.bean.PageEntity;
import com.epicsaas.app.ksdapp.android.bean.Product;
import com.epicsaas.app.ksdapp.appobject.ShopUserAO;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;

import javax.validation.Valid;

import org.springframework.ui.Model;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * recommend 推荐
 * 
 */
@Controller
@RequestMapping(value = "/phone/recommend")
public class RecommendController {

    private static Logger LOG = LoggerFactory.getLogger(RecommendController.class);

    @RequestMapping(value = "", method = RequestMethod.GET)
    @ResponseBody
    public Object getAll(Model model, HttpServletRequest request) {
        LOG.info("有访问来自，IP: %s USER-AGENT: %s", request.getRemoteAddr(), request.getHeader("user-agent"));
        LOG.info("SessionId %s", request.getSession().getId());
        ServiceResult<Object> ret = new ServiceResult<Object>();
        ret.setData(DateTimeUtils.formateDateToStr(new Date(), DateTimeUtils.FORMAT_YMD_HMS));
        return ret;
    }

    @RequestMapping(value = "/add", method = { RequestMethod.GET, RequestMethod.POST })
    @ResponseBody
    public Object add(Model model, HttpServletRequest request) {
        LOG.info("有访问来自，IP: %s USER-AGENT: %s", request.getRemoteAddr(), request.getHeader("user-agent"));
        LOG.info("SessionId %s", request.getSession().getId());
        ServiceResult<Object> ret = new ServiceResult<Object>();
        ret.setData(DateTimeUtils.formateDateToStr(new Date(), DateTimeUtils.FORMAT_YMD_HMS));
        return ret;
    }

    @RequestMapping(value = "/view/{dataId}", method = { RequestMethod.GET, RequestMethod.POST })
    @ResponseBody
    public Object viewById(@PathVariable String dataId, Model model, HttpServletRequest request) {
        LOG.info("有访问来自，IP: %s USER-AGENT: %s", request.getRemoteAddr(), request.getHeader("user-agent"));
        LOG.info("SessionId %s", request.getSession().getId());
        ServiceResult<Object> ret = new ServiceResult<Object>();
        ret.setData(DateTimeUtils.formateDateToStr(new Date(), DateTimeUtils.FORMAT_YMD_HMS));
        return ret;
    }

    @RequestMapping(value = "/update/{dataId}", method = { RequestMethod.GET, RequestMethod.POST })
    @ResponseBody
    public Object updateById(@PathVariable String dataId, Model model, HttpServletRequest request) {
        LOG.info("有访问来自，IP: %s USER-AGENT: %s", request.getRemoteAddr(), request.getHeader("user-agent"));
        LOG.info("SessionId %s", request.getSession().getId());
        ServiceResult<Object> ret = new ServiceResult<Object>();
        ret.setData(DateTimeUtils.formateDateToStr(new Date(), DateTimeUtils.FORMAT_YMD_HMS));
        return ret;
    }

    @RequestMapping(value = "/delete/{dataId}", method = { RequestMethod.GET, RequestMethod.POST })
    @ResponseBody
    public Object deleteById(@PathVariable String dataId, Model model, HttpServletRequest request) {
        LOG.info("有访问来自，IP: %s USER-AGENT: %s", request.getRemoteAddr(), request.getHeader("user-agent"));
        LOG.info("SessionId %s", request.getSession().getId());
        ServiceResult<Object> ret = new ServiceResult<Object>();
        ret.setData(DateTimeUtils.formateDateToStr(new Date(), DateTimeUtils.FORMAT_YMD_HMS));
        return ret;
    }

}
